package com.android.core.base;

import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.android.core.utils.AppManager;
import com.android.core.utils.log.Logger;

import butterknife.ButterKnife;


public abstract class BaseActivity extends AppCompatActivity {

    public Context mContext = null;//context

    protected abstract int getLayoutResource();

    protected abstract void onInitView(Bundle bundle);


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Logger.d("name (%s.java:0)", getClass().getSimpleName());
        AppManager.getAppManager().addActivity(this);
        int layoutResource = getLayoutResource();
        if (layoutResource != 0)
            setContentView(layoutResource);
        ButterKnife.bind(this);
        mContext = this;
        onInitView(savedInstanceState);
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        AppManager.getAppManager().finishActivity(this);
    }

}
